package com.example;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;


@RestController
public class DataController {
    @Autowired
    UserRepository userRepository;
    @RequestMapping("/findAll")
    public List<User> findAll(){
        List<User> user=userRepository.findAll();
        return user;
    }
    @RequestMapping("/findByPhone")
    public User findByPhone(String phone){
        return userRepository.findByPhone(phone);
    }
    @RequestMapping("/findByCity")
    public List<User> findByCity(String city){
        return userRepository.findByCity(city);
    }

}
